package com.learn.mongo.domain;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/8/26 14:47
 */
@Document(collection="city")
public class City implements Serializable
{
    @Id
    private ObjectId objectId;
    private long id;
    private String name;

    public ObjectId getObjectId()
    {
        return objectId;
    }

    public void setObjectId(ObjectId objectId)
    {
        this.objectId = objectId;
    }

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Override
    public String toString()
    {
        return "City{" +
                "objectId=" + objectId +
                ", id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    public City(long id, String name)
    {
        this.id = id;
        this.name = name;
    }
}
